package com.question.thread.pool;

/**
 * @data 2012-10-30 下午03:02:42
 * @author nassir wen
 */
public class SimpleTaskTest extends Task {
    @Override
    public void deal() {
        // do something
        System.out.println("do do do ...");
    }

    public static void main(String[] args) throws InterruptedException {
        ThreadPoolService service = new ThreadPoolService();
        service.start();
        // 执行十次任务
        for (int i = 0; i < 10; i++) {
            service.runTask(new SimpleTaskTest());
        }
        // 睡眠1秒钟，等待所有任务执行完毕
        Thread.sleep(10*1000);
        
        System.out.println("我是在sleep 之后");
        service.stop();
        
        for (int i = 0; i < 10; i++) {
            service.runTask(new SimpleTaskTest());
        }
        System.out.println("----------------");
        
    }
}